package pers.liyan.shi.springcloud;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import pers.liyan.shi.ribbon.MyRibbonConfig;

@EnableHystrix
@SpringBootApplication()
@EnableEurekaClient
@EnableFeignClients(basePackages = "pers.liyan.shi.springcloud.service")
/**
 * Ribbon 实现客户端负载均衡, 为某个微服务单独配置负载均衡配置, {@code configuration}中
 * 配置的类要用{@code @Configuration}标注, 但是不能在spring扫描的包下,否则这个配置会被所有的负载均衡客户端共享
 */
@RibbonClient(name = "SPRINGCLOUD-MICROSERVICE-PROVIDER-DEPT", configuration = {MyRibbonConfig.class})
/**
 * 使用 {@code @RibbonClients} 的 {@code defaultConfiguration}属性配置所有 Ribbon 客户端
 */
// @RibbonClients(defaultConfiguration = MyRibbonConfig.class)
public class SpringCloudDeptConsumerApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringCloudDeptConsumerApplication.class);
    }
}
